#ifndef RBTEE_H
#define RBTEE_H

#include "tree.h"
#include "rbnode.h"

class RBTree:public Tree{
public:
    RBTree(TreeNode *node):Tree(node){}
    RBTree(int val):Tree(val){}
    virtual ~RBTree(){
        if(alloc_in_function)
            delete root;
    }
    typedef void (RBTree::*Draw)(RBTree *tree);
    typedef void (RBTree::*DrawSelf)(RBNode *node);

    void insert(RBNode *node);

    void leftRotate();
    void rightRotate();

private:
    RBNode *root;
    Draw draw;
    DrawSelf drawSelf;
};



#endif // RBTEE_H
